package com.yidu.drug.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import com.yidu.drug.action.vo.InvoiceDetailVo;
import com.yidu.drug.dao.InvoiceDetailModelMapper;
import com.yidu.drug.model.InvoiceDetailModel;
import com.yidu.drug.service.InvoiceDetailService;

@Service
public class InvoiceDetailServiceImpl implements InvoiceDetailService{
	@Resource
	private InvoiceDetailModelMapper InvoiceDetailModelDao;
	/**
	 * 根据ID查询
	 */
	@Override
	public InvoiceDetailVo findById(String id) {
		InvoiceDetailModel po=InvoiceDetailModelDao.selectByPrimaryKey(id);
		InvoiceDetailVo vo=new InvoiceDetailVo();
		BeanUtils.copyProperties(po, vo);
		return vo;
	}
	
	/**
	 * 查询所有
	 */
	@Override
	public List<InvoiceDetailModel> findAlls() {
		System.out.println("查询成功===============================");
		return InvoiceDetailModelDao.findAlls();
	}
	/**
	 * 增加方法
	 */
	@Override
	public int add(InvoiceDetailVo vo) {
		InvoiceDetailModel po=new InvoiceDetailModel();
		BeanUtils.copyProperties(vo, po);
		System.out.println("增加成功===============================");
		return InvoiceDetailModelDao.insert(po);
	}
	
}